<template>
  <div>
    <h2>学校名称：{{schoolName}} 学生人数：{{students.length}} 姓王的人数:{{countWang}}</h2>

    <h2>分校列表</h2>
    <ul v-for="sch in schools " :key="sch.id">
      <li>{{ sch.name }}</li>
    </ul>
    <input type="text" placeholder="输入分校名称" v-model="name">
    <button @click="addSch(name)">添加一个分校</button>
    <button @click="addHb(name)">添加一个分校,名称湖北开头</button>
  </div>
</template>
<script>


import {mapState,mapActions,mapMutations,mapGetters} from 'vuex';
  export default {
    name:'School',
    data(){
      return{name:''}
    },
    computed:{
      ...mapState('schoolAbout',['schoolName','students','schools']),
      ...mapState('studentAbout',['students']),
      ...mapGetters('studentAbout',['countWang'])
    },
    methods:{
      ...mapActions('schoolAbout',['addSch','addHb'])
    }
  }

</script>
<style></style>
